Restructure the GdkEvent type hierarchy
authorEmmanuele Bassi <ebassi@gnome.org>
Thu, 16 Apr 2020 16:23:36 +0000 (17:23 +0100)
committerEmmanuele Bassi <ebassi@gnome.org>
Thu, 16 Apr 2020 18:54:02 +0000 (19:54 +0100)
commitf28aa1ba026dad82c4d3a128f99d4e99615a5a52
tree4ae2801c19e8b53b6b491961575ea5d03af35d0c
parent96cfb12946f13581a2ecd89da035f14b555a0a47
Restructure the GdkEvent type hierarchy

GdkEvent has been a "I-can't-believe-this-is-not-OOP" type for ages,
using a union of sub-types. This has always been problematic when it
comes to implementing accessor functions: either you get generic API
that takes a GdkEvent and uses a massive switch() to determine which
event types have the data you're looking for; or you create namespaced
accessors, but break language bindings horribly, as boxed types cannot
have derived types.

The recent conversion of GskRenderNode (which had similar issues) to
GTypeInstance, and the fact that GdkEvent is now a completely opaque
type, provide us with the chance of moving GdkEvent to GTypeInstance,
and have sub-types for GdkEvent.

The change from boxed type to GTypeInstance is pretty small, all things
considered, but ends up cascading to a larger commit, as we still have
backends and code in GTK trying to access GdkEvent structures directly.
Additionally, the naming of the public getter functions requires
renaming all the data structures to conform to the namespace/type-name
pattern.
34 files changed:
docs/reference/gtk/migrating-3to4.xml
gdk/broadway/gdkeventsource.c
gdk/gdkdisplay.c
gdk/gdkdrop.c
gdk/gdkevents.c
gdk/gdkevents.h
gdk/gdkeventsprivate.h
gdk/gdksurface.c
gdk/wayland/gdkdevice-wayland.c
gdk/wayland/gdksurface-wayland.c
gdk/win32/gdkdevicemanager-win32.c
gdk/win32/gdkdrag-win32.c
gdk/win32/gdkevents-win32.c
gdk/win32/gdksurface-win32.c
gdk/x11/gdkdevicemanager-xi2.c
gdk/x11/gdkdisplay-x11.c
gdk/x11/gdkdrag-x11.c
gdk/x11/gdkeventsource.c
gdk/x11/gdksurface-x11.c
gtk/gtkdroptarget.c
gtk/gtkdroptargetasync.c
gtk/gtkeventcontrollerlegacy.c
gtk/gtkgesturerotate.c
gtk/gtkgesturestylus.c
gtk/gtkgesturezoom.c
gtk/gtkiconview.c
gtk/gtkimcontextsimple.c
gtk/gtkmain.c
gtk/gtkmarshalers.list
gtk/gtkpadcontroller.c
gtk/gtkwidget.c
gtk/gtkwindow.c
testsuite/gtk/gestures.c
testsuite/gtk/shortcuts.c